package com.zhuss.controller.core;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.common.AbstractBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.SelectVo;
import com.zhuss.core.processor.EnumConfig;
import com.zhuss.enums.CompanyType;
import com.zhuss.enums.EnumUtil;
import com.zhuss.enums.ImportType;
import com.zhuss.enums.IsEnum;
import com.zhuss.enums.RequestMethod;
import com.zhuss.enums.ResourceType;
import com.zhuss.enums.RoleType;
import com.zhuss.enums.Sex;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.enums.SystemEnum;
import com.zhuss.exception.OceanException;
import com.zhuss.util.DateUtil;


/**
 * 下拉框 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */
  
@RestController
@RequestMapping("/select")
public class SelectController extends BaseController {
	
	@Autowired
	private EnumConfig enumConfig;

		
	/**
	 * 是否下拉框
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
    @RequestMapping("/isList")
    public Object isList() throws OceanException {
		return EnumUtil.listSelect(IsEnum.class);
    }
	
	/**
	 * 系统
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
    @RequestMapping("/systemList")
    public Object systemList() throws OceanException {
		return EnumUtil.listSelect(SystemEnum.class);
    }
	
	/**
	 * 资源类型
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
    @RequestMapping("/resourceTypeList")
    public Object resourceTypeList() throws OceanException {
		return EnumUtil.listSelect(ResourceType.class);
    }
	
	/**
	 * 请求方法
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@RequestMapping("/requestMethodList")
	public Object requestMethodList() throws OceanException {
		return EnumUtil.listSelect(RequestMethod.class);
	}
	
	/**
	 * 角色类型
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@RequestMapping("/roleTypeList")
	public Object roleTypeList() throws OceanException {
		return EnumUtil.listSelect(RoleType.class);
	}
	
	/**
	 * 启用停用
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@RequestMapping("/startStopList")
	public Object startStopList() throws OceanException {
		return EnumUtil.listSelect(StartStopEnum.class);
	}
	
	/**
	 * 性别
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@RequestMapping("/sexList")
	public Object sexList() throws OceanException {
		return EnumUtil.listSelect(Sex.class);
	}
	
	/**
	 * 公司类型
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@RequestMapping("/companyTypeList")
	public Object companyTypeList() throws OceanException {
		return EnumUtil.listSelect(CompanyType.class);
	}
	
		
		
	/**
	 * 导入类型下拉框
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@PostMapping("/importTypeList")
	public Object importTypeList(@RequestBody AbstractBo bo) throws OceanException {
		return EnumUtil.listSelect(ImportType.class);
	}
	
	/**
	 * 未来周下拉框
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@PostMapping("/futureWeekList")
	public Object futureWeekList(@RequestBody AbstractBo bo) throws OceanException {
		List<SelectVo> weekList = DateUtil.toWeekList(4l);
		return weekList;
	}
		
	/**
	 * 设备种类
	 * @return
	 * @throws OceanException
	 */
	@ResponseBody
	@PostMapping("/deviceKindList")
	public Object deviceKindList(@RequestBody AbstractBo bo) throws OceanException {
		return enumConfig.listSelectDeviceKind();
	}

	
}
